package com.yl.module.property.controller;

import com.yl.module.property.domain.vo.PropertyTypeTreeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import lombok.extern.slf4j.Slf4j;
import io.swagger.annotations.Api;
import com.yl.module.property.service.PropertyTypeService;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import com.yl.module.property.domain.PropertyType;
import com.yl.module.property.domain.vo.PropertyTypeVO;
import com.yl.module.property.domain.dto.PropertyTypeDTO;
import com.yl.common.core.domain.Result;
import javax.validation.constraints.NotNull;
import java.util.List;
import javax.validation.constraints.NotEmpty;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.multipart.MultipartFile;

/**
 * 资产类型表 Controller控制层
 * @author makejava
 * @date 2024-10-23 15:54:16
 */
@Slf4j
@RestController
@Api(tags = "资产类型")
@RequestMapping("/propertyType")
@Validated
public class PropertyTypeController {
    /**
     * 资产类型表 Service
     */
    @Autowired
    public PropertyTypeService propertyTypeService;

	@GetMapping("/getAll")
	@ApiOperation(value = "查找所有构件类型 非树结构", notes = "")
	public Result<List<PropertyTypeVO>> getAll(
	) {
		List<PropertyTypeVO> result = propertyTypeService.getAll();
		return Result.ok(result);
	}

	@GetMapping("/getTree")
	@ApiOperation(value = "按照资产一级分类查询分类树结构", notes = "")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "id", value = "资产一级分类id 1家电 2安消 3家具 4构件", required = true, dataType = "MultipartFile"),
	})
	public Result<List<PropertyTypeTreeVO>> getTree(
			@RequestParam(name = "id") Integer id
	) {
		List<PropertyTypeTreeVO> result = propertyTypeService.getTree(id);
		return Result.ok(result);
	}

	@GetMapping("/getComponentMaintainState")
	@ApiOperation(value = "查询构件类型的保养状态", notes = "")
	public Result<List<PropertyTypeTreeVO>> getComponentMaintainState(
	) {
		List<PropertyTypeTreeVO> result = propertyTypeService.getComponentMaintainState();
		return Result.ok(result);
	}


}

